package com.yxy.controller;

import com.yxy.base.BusinessException;
import com.yxy.base.Pagingable;
import com.yxy.base.RestResponse;
import com.yxy.dto.SysLoginInfoDto;
import com.yxy.feign.AuthService;
import com.yxy.model.SysLoginInfo;
import com.yxy.service.SysLoginInfoService;
import com.yxy.utils.TokenCheckUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author lixinquan
 * 登录日志
 */
@RestController
@Slf4j
@RequestMapping("/sysLoginInfo")
public class SysLoginInfoController {

  @Autowired
  private TokenCheckUtil tokenCheckUtil;

  @Autowired
  private AuthService authService;
  @Autowired
  private SysLoginInfoService SysLoginInfoService;

  // 获取列表
  @Pagingable
  @PostMapping("/list")
  public RestResponse<List<SysLoginInfo>> getList(@RequestBody SysLoginInfoDto input) throws BusinessException {
    RestResponse<List<SysLoginInfo>> restResponse = new RestResponse<>(200, "成功");
    restResponse.setContent(SysLoginInfoService.getlist(input));
    return restResponse;
  }




  //创建与修改
  @PostMapping("/create")
  public RestResponse<SysLoginInfo> create() throws BusinessException {
    RestResponse<SysLoginInfo> restResponse = new RestResponse<>(200, "成功");
    restResponse.setContent(SysLoginInfoService.save());
    return restResponse;
  }










}
